<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			class Animal{
				constructor(name,a,t) {
				    this.name=name;
					this.age=a;
					this.type=t;
				}
				getName(){
					return this.name;
				}
				getAge(){
					return this.age;
				}
				increase(){
					this.age++;
				} 
				toString(){
					return this.name+","+this.age+","+this.type;
				}
			}
			class Dog extends Animal{
				constructor(name,a,t,w){
					super(name,a,t);
					this.weight=w;
				} 
				getName(){
					return "我的名字叫"+super.getName();
				}
				increase(){
					super.increase();
					this.weight+=20;
				}
				toString(){
					return super.toString()+",体重是"+this.weight+"公斤";
				}
			}
			var a=new Animal("小五花",1,"肥猪");
			alert(a);
			alert("名字是："+a.getName());
			a.increase();
			alert("一年后，他多大了？"+a.getAge());
			var d=new Dog("哮天犬",10000,"中华田园犬",455);
			alert(d);
			alert(d.getName());
			d.increase();
			alert(d);
		</script>
	</head>
	<body>
	</body>
</html>
